<!--#include file="Config.asp"-->
<!--#include file="emp_is.asp"-->
<!--#include file="Header.asp"-->
<%
menu=request("menu")
ad=request("ad")
user=Request.Cookies("aduser")

if menu="zhiwei" then
set rs=server.createobject("adodb.recordset")
sql="select * from [basic_title]"
rs.open sql,conn,1,3

if ad="save" then
rs.addnew
rs("lei")=request("lei")
rs("jiage")=request("jiage")
rs("suan")=request("suan")
rs.update
rs.close
response.write "<script>alert('职位价格设置。');location.href='?menu=zhiwei'</script>"
end if

set rsg=server.createobject("adodb.recordset")
sql="select * from [basic_title]"
rsg.open sql,conn,1,3
%>
<table class="table">
  <form name="form1" method="post" action="?menu=zhiwei&ad=save">
    <tr>
      <th colspan="2">设置职位工资</th>
    </tr>
    <tr>
      <td>职位名称：</td>
      <td><!-- <input name="lei" type="text" id="lei" size="40"> -->
	  <select name="EMP_title"><%
sqls="select * from basic_title order by t_id"
rss.open sqls,conn,1,1
for r=1 to rss.recordcount
%><option value="<%=int(rss("t_id"))%>"><%=int(rss("t_id"))%>.<%=rss("t_title")%></option>
<%
rss.moveNext
next
rss.close
%></select>[<a href="Emp_title_Admin.ASP">岗位管理</a>]</td>
    </tr>
    <tr>
      <td>工 资：</td>
      <td><input name="jiage" type="text" id="jiage" value="" size="40">
      单位：元</td>
    </tr>
    <tr>
      <td>结算类型：</td>
      <td><select name="suan" id="suan">
        <option value="年" selected>年</option>
        <option value="月">月</option>
        <option value="周">周</option>
		<option value="季">季</option>
        <option value="日">日</option>
      </select>
      </td>
    </tr>
    <tr>
	      <td>&nbsp;</td>

      <td>
        <input type="submit" name="Submit22322" value="提交">
      </td>
    </tr>
  </form>
</table>

<table class="table">
  <tr>
    <th colspan="4">职位薪资表</th>
  </tr>
  <tr>
    <td>职位名称</td>
    <td width="39%">工资</td>
    <td>结算类型</td>
    <td width="12%"></td>
  </tr>
  <%do while not rsg.eof%>
  <tr>
    <td><%=rsg("t_title")%> </td>
    <td><%=rsg("t_price")%>元</td>
    <td><%=rsg("MoneyType")%></td>
    <td>操作</td>
  </tr>
  <%rsg.movenext
                  loop
                  rsg.close
                  set rs=nothing
                  %>
</table>
<%end if%>

<%if menu="jiesuan" then

set rs=server.createobject("adodb.recordset")
sql="select * from [Salary_jiesuan]"
rs.open sql,conn,1,1

if ad="save" then
name=request("name")
id=request("id")
set rsa=server.createobject("adodb.recordset")
sql="delete * from [Salary_qiandao] where name='"&name&"'"
rsa.open sql,conn,1,3

set rsf=server.createobject("adodb.recordset")
sql="select * from [Salary_jiesuan] where id="&id
rsf.open sql,conn,1,3
rsf("ok")="yes"
rsf.update
rsf.close
response.Redirect("?menu=jiesuan")
end if
if ad="del" then
id=request("id")
set rsd=server.createobject("adodb.recordset")
sql="delete * from [Salary_jiesuan] where id="&id
rsd.open sql,conn,1,3
response.Redirect("?menu=jiesuan")
end if
%>
<table class="table">
  <tr>
    <th colspan="6">结算信息管理</th>
  </tr>
  <tr>
    <td>姓名</td>
    <td width="23%">结算日期</td>
    <td width="15%">价格</td>
    <td>工作时间</td>
    <td width="16%">结算费用</td>
    <td width="12%"></td>
  </tr>
  <%do while not rs.eof%>
  <tr>
    <td><%=rs("name")%> </td>
    <td><%'=rs("riqi")-rs("time")%> - <%=rs("riqi")%></td>
    <td><%=rs("jiage")%>元/<%=rs("lei")%></td>
    <td><%=rs("time")%>天</td>
    <td><%=rs("zong")%>元</td>
    <td><%if rs("ok")="no" then%><a href="?menu=jiesuan&ad=save&name=<%=rs("name")%>&id=<%=rs("id")%>">结算</a><%else%>已结算<%end if%>
        <a href="?menu=jiesuan&ad=del&id=<%=rs("id")%>">删除</a></td>
  </tr>
  <%rs.movenext
                  loop
                  rs.close
                  set rs=nothing
                  %>
</table>
<%end if%>

<%if menu="yue" then

if ad="jie" then
set rsf=server.createobject("adodb.recordset")
sql="select * from [Salary_jiesuan]"
rsf.open sql,conn,1,3
do while not rsf.eof
rsf("ok")="yes"
rsf.update
rsf.movenext
loop
response.write "<script>alert('结算成功。');location.href='?menu=jiesuan'</script>"
end if
if ad="zong" then
set rsvl=server.createobject("adodb.recordset")
sql="select * from [user]"
rsvl.open sql,conn,1,3
do while not rsvl.eof
name=rsvl("name")
set rsf=server.createobject("adodb.recordset")
sqlf="select * from [user] where name='"&name&"'"
rsf.open sqlf,conn,1,3
lei2=rsf("zhiwei")

set rs3=server.createobject("adodb.recordset")
sql3="select * from [zhiwei] where lei='"&lei2&"'"
rs3.open sql3,conn,1,3
suan=rs3("suan")
jiage=rs3("jiage")

if suan="年" then
tian=jiage/365
tian=Round(tian, 2)
elseif suan="季" then
tian=jiage/90
tian=Round(tian, 2)
elseif suan="月" then
tian=jiage/30
tian=Round(tian, 2)
elseif suan="周" then
tian=jiage/7
tian=Round(tian, 2)
elseif suan="日" then
tian=jiage
end if
set rs=server.createobject("adodb.recordset")
sql="select * from [Salary_qiandao] where name='"&name&"'"
rs.open sql,conn,1,3
shu2=rs.recordcount
zong=tian*shu2
set rse=server.createobject("adodb.recordset")
sqle="select * from [Salary_jiesuan]"
rse.open sqle,conn,1,3
rse.addnew
rse("name")=name
rse("riqi")=date()
rse("jiage")=jiage
rse("time")=shu2
rse("zong")=zong
rse("lei")=suan
rse("ok")="yes"
rse("bei")=request("bei")
rse.update
rse.close
set rsd=server.createobject("adodb.recordset")
sql="delete * from [Salary_qiandao] where name='"&name&"'"
rsd.open sql,conn,1,3

rsvl.movenext
loop
rsvl.close
set rsvl=nothing
response.write "<script>alert('结算成功。');location.href='?menu=jiesuan'</script>"
end if
%>
<table class="table">
  <tr>
    <th>管理员月结操作</th>
  </tr>
  <tr>
    <td>1.结算所有已经提交的结算请求。
      <input name="button42" type=button class="button" onClick="location.href='?menu=yue&ad=jie'" value="执行结算请求"></td>
  </tr>
  <form name="form2" method="post" action="?menu=list&ad=jie">
  <tr>
    <td>2.请选择员工：
	  <%set rsvl=server.createobject("adodb.recordset")
sql="select * from [user]"
rsvl.open sql,conn,1,3%><select name="user" id="user">
        <%do while not rsvl.eof%>
        <option value="<%=rsvl("name")%>"><%=rsvl("name")%> - <%=rsvl("zhiwei")%></option>
        <%rsvl.movenext
                  loop
                  rsvl.close
                  set rsvl=nothing
                  %>
      </select>
        <input type="submit" name="Submit3" value="结算该员工工资">      </td>
  </tr>
  <tr>
    <td>3. 此操作结算所有员工工资。
      <input name="button2" type=button class="button" onClick="location.href='?menu=yue&ad=zong'" value="结算所有用户工资"></td>
  </tr>
  </form>
</table>
<%end if%>
<%if menu="qiandao" then
set rs=server.createobject("adodb.recordset")
sql="select * from [Salary_qiandao]"
rs.open sql,conn,1,1

if ad="save" then
name=request("name")
set rsa=server.createobject("adodb.recordset")
sql="delete * from [Salary_qiandao] where name='"&name&"'"
rsa.open sql,conn,1,3

set rsf=server.createobject("adodb.recordset")
sql="select * from [Salary_jiesuan] where name='"&name&"'"
rsf.open sql,conn,1,3
rsf("ok")="yes"
rsf.update
rsf.close
response.Redirect("?menu=jiesuan")
end if
If rs.recordcount<>0 then
%>
<table class="table">
  <tr bgcolor="#698CC3">
    <td width="6%">编号</td>
    <td width="13%" bgcolor="#698CC3">签到日期</td>
    <td width="13%">员工姓名</td>
    <td width="13%">上班时间</td>
    <td width="17%">下班时间</td>
    <td width="17%">迟到说明</td>
    <td width="16%">当日工资</td>
    <td width="5%">&nbsp;</td>
  </tr>
  <%
rs.PageSize=20
pagecount=rs.PageCount
page=int(request.QueryString ("page"))
if page<=0 then page=1
if request.QueryString("page")="" then
page=1
end if
rs.AbsolutePage=page
for i=1 to rs.PageSize
'if rs.EOF Or rs.bof then
'exit for
'end if

%>
  <form action="?menu=del" method="post" onSubmit="return Confirm()">

  <tr bgcolor="#FFFFFF" onMouseOver="style.backgroundColor='#f3fede'"
            onmouseout="style.backgroundColor='#ffffff'">
    <td><%=rs("id")%></td>
    <td><%=rs("riqi")%></td>
    <td><%=rs("name")%></td>
    <td>
      <%=rs("time")%>
    </td>
    <td><%=rs("time2")%></td>
    <td><%=rs("bei")%></td>
    <td><%=gongzi%>元</td>
    <td></td>
  </tr>
  <%
rs.movenext
next
%>
</table>
<table class="table">
  <tr>
    <td align="right">当前共有<font color=red><strong><%=rs.recordcount%> </strong></font>记录
      <%if page=1 and not page=pagecount then%>
      第<%=page%>页
      <%for i=1 to pagecount%>
      <a href="?menu=qiandao&page=<%=i%>"><%=i%></a>
      <%next%>
      <a href="?menu=qiandao&page=<%=page+1%>">下页</a>
      <%elseif page=pagecount and not page=1 then%>
      第<%=page%>页
      <%for i=1 to pagecount%>
      <a href="?menu=qiandao&page=<%=i%>"><%=i%></a>
      <%next%>
      <a href="?menu=qiandao&page=<%=page-1%>">上页</a>
      <%elseif page<1 then%>
      没有任何记录！
      <%elseif page>pagecount then%>
      没有任何记录！
      <%elseif page=1 and page=pagecount then%>
      <%else%>
      第<%=page%>页
      <%for i=1 to pagecount%>
      <a href="?menu=qiandao&page=<%=i%>"><%=i%></a>
      <%next%>
      <a href="?menu=qiandao&page=<%=page-1%>">上页</a> <a href="?menu=qiandao&page=<%=page+1%>">下页</a>

      <%end if%></td>
  </tr>
</table>
<%
End If
end If
%>
<%if menu="xianjin" then
set rs=server.createobject("adodb.recordset")
sql="select * from [Salary_gongzi]"
rs.open sql,conn,1,1

if ad="save" then
id=request("id")
set rsf=server.createobject("adodb.recordset")
sql="select * from [Salary_gongzi] where id="&id
rsf.open sql,conn,1,3
rsf("ok")="yes"
rsf.update
rsf.close
response.Redirect("?menu=xianjin")
end if
%>
<table class="table">
  <tr>
    <th colspan="8">现金提取清单</th>
  </tr>
  <tr>
    <td width="12%">姓名</td>
    <td width="11%">累计工资</td>
    <td width="10%">累计提取</td>
    <td width="9%">可用余额</td>
    <td width="12%">本次提取</td>
    <td width="11%">申请时间</td>
    <td width="23%">提取说明</td>
    <td width="12%"></td>
  </tr>
  <%do while not rs.eof%>
  <tr>
    <td><%=rs("name")%> </td>
    <td><%=rs("gongzi")%>元</td>
    <td><%=rs("leiji")%>元</td>
    <td><%=cint(rs("gongzi"))-cint(rs("leiji"))%>元</td>
    <td><%=rs("shangci")%>元</td>
    <td><%=rs("time")%></td>
    <td><%=rs("bei")%></td>
    <td>
      <%if rs("ok")="no" then%>
      <a href="?menu=xianjin&ad=save&id=<%=rs("id")%>">等待发放</a>
      <%else%>
      已发放
      <%end if%>
    </td>
  </tr>
  <%rs.movenext
                  loop
                  rs.close
                  set rs=nothing
                  %>
</table>
<%end if%>
<%
if menu="addjie" then

if ad="save" then
set rse=server.createobject("adodb.recordset")
sqle="select * from [Salary_jiesuan]"
rse.open sqle,conn,1,3
rse.addnew
rse("name")=request("name")
rse("riqi")=request("riqi")
rse("jiage")=request("jiage")
rse("time")=request("tian")
rse("zong")=request("zong")
rse("lei")=request("lei")
rse("ok")="yes"
rse("jiang")=request("jiang")
rse("ti")=request("ti")
rse("bu")=request("bu")
rse.update
rse.close
response.write "<script>alert('已经提交结算信息。');location.href='?menu=addjie'</script>"
response.End
end if
%>
<table class="table">
  <form name="form1" method="post" action="?menu=addjie&ad=save">
    <tr>
      <th colspan="2">添加结算工资</th>
    </tr>
    <tr>
      <td>选择员工：</td>
      <td><select name="name" id="name">
<%
sql="Select emp_ID,emp_name From [emp_staff] where emp_lock=1 order by emp_ID"
rs.open sql,conn,1,1
For u=1 To rs.recordcount
%>
<option value="<%=int(rs("emp_ID"))%>" <%If int(rs("emp_ID"))=int(selname) then%>selected<%End if%>><%=Trim(rs("emp_name"))%></option>
<%
rs.movenext
Next
rs.close
%>
      </select>
      <a href="?menu=zhiwei" target="_blank">查询职位工资</a></td>
    </tr>
    <tr>
      <td>开始日期：</td>
      <td><input name="riqi" type="text" id="riqi" size="30" value="<%=date()%>" class= "easyui-datebox" required ="required"> </input>
</td>
    </tr>
    <tr>
      <td>职位工资：</td>
      <td><input name="jiage" type="text" id="jiage" size="30">
        元。　只果记不清“职位工资”，请核对职位工资</td>
    </tr>
    <tr>
      <td>工资类型：</td>
      <td><select name="lei" id="lei">
        <option value="年" selected>年</option>
        <option value="月">月</option>
        <option value="周">周</option>
        <option value="季">季</option>
        <option value="日">日</option>
      </select>
        对应上面的，如果输入“月”表示5000元/月。此栏应以职位工资为准。</td>
    </tr>
    <tr>
      <td>发放工资：</td>
      <td><input name="zong" type="text" id="zong" size="30">
      元。　从开始日期到今日，应该付多少工资。</td>
    </tr>
    <tr>
      <td>共上班</td>
      <td><input name="tian" type="text" id="tian" size="30">
      天</td>
    </tr>
    <tr>
      <td>奖金：</td>
      <td><input name="jiang" type="text" id="jiang" size="30">
        元</td>
    </tr>
    <tr>
      <td>提成：</td>
      <td><input name="ti" type="text" id="ti" size="30">
      元</td>
    </tr>
    <tr>
      <td>补助：</td>
      <td><input name="bu" type="text" id="bu" size="30">
      元</td>
    </tr>
    <tr>
      <td colspan="2">
        <input type="submit" name="Submit223233" value="提交">
      </td>
    </tr>
  </form>
</table>
<%end if%>
<%if menu="zhiwei2" then
Set rsj = Server.CreateObject("ADODB.Recordset")
sql="select * from [admin] where name='"&user&"'"
rsj.open sql,conn,1,1
if rsj.eof then
Response.Write("<div align=center><br><br><br><br><br><br><br>·不存在该用户或者该用户已经是管理员<br><br><a href='javascript:history.go(-1)'><img border=0 src=menu/face12.gif align=absmiddle><font color=#000000>返回重新填写!</font></a>")
else
fen=rsj("fen")
lei=split(fen,"|")
if lei(15)="0" then
Response.Write("<div align=center><img src=menu/face12.gif>贴心提示:“16.可能是您的后台等级不适和该操作;因此系统已自动将其保留,望以后多努力哦!”")
response.End
end if
end if
zhi=""
set rs=server.createobject("adodb.recordset")
sql="select * from [user] where zhiwei<>'"&zhi&"'"
rs.open sql,conn,1,3
%>
<table class="table">
  <tr bgcolor="#698CC3">
    <td width="9%">编号</td>
    <td width="15%">用户名</td>
    <td width="11%">职位</td>
    <td width="10%">工资</td>
    <td width="16%">工牌号</td>
    <td width="15%">联系电话</td>
    <td width="24%">银行帐号</td>
  </tr>
  <%
rs.PageSize=20 //每页显示数
pagecount=rs.PageCount
page=int(request.QueryString ("page"))
if page<=0 then page=1
if request.QueryString("page")="" then
page=1
end if
rs.AbsolutePage=page
for i=1 to rs.PageSize
if rs.EOF then
exit for
end if

lei=rs("zhiwei")

set rsvl=server.createobject("adodb.recordset")
sql="select * from [zhiwei] where lei='"&lei&"'"
rsvl.open sql,conn,1,3
%>
  <form action="?menu=del" method="post" onSubmit="return Confirm()">

  <tr bgcolor="#FFFFFF" onMouseOver="style.backgroundColor='#f3fede'"
            onmouseout="style.backgroundColor='#ffffff'">
    <td><%=rs("id")%></td>
    <td><a href="?menu=eduser&name=<%=rs("name")%>"><%=rs("name")%></a></td>
    <td><%=rs("zhiwei")%></td>
    <td><%=rsvl("jiage")%>元/<%=rsvl("suan")%></td>
    <td><%=rs("gong")%></td>
    <td><%=rs("tel")%></td>
    <td><%=rs("yin")%> </td>
  </tr>
  <%
rs.movenext
next
%>
</table>
<table class="table">
  <tr>
    <td align="right">当前共有<font color=red><strong><%=rs.recordcount%> </strong></font>记录
      <%if page=1 and not page=pagecount then%>
      第<%=page%>页
      <%for i=1 to pagecount%>
      <a href="?menu=zhiwei2&page=<%=i%>"><%=i%></a>
      <%next%>
      <a href="?menu=zhiwei2&page=<%=page+1%>">下页</a>
      <%elseif page=pagecount and not page=1 then%>
      第<%=page%>页
      <%for i=1 to pagecount%>
      <a href="?menu=zhiwei2&page=<%=i%>"><%=i%></a>
      <%next%>
      <a href="?menu=zhiwei2&page=<%=page-1%>">上页</a>
      <%elseif page<1 then%>
      没有任何记录！
      <%elseif page>pagecount then%>
      没有任何记录！
      <%elseif page=1 and page=pagecount then%>
      <%else%>
      第<%=page%>页
      <%for i=1 to pagecount%>
      <a href="?menu=zhiwei2&page=<%=i%>"><%=i%></a>
      <%next%>
      <a href="?menu=zhiwei2&page=<%=page-1%>">上页</a> <a href="?menu=zhiwei2&page=<%=page+1%>">下页</a>

      <%end if%></td>
  </tr>
</table>
<%end if%>


<!--#include file="Footer.asp" -->
